import 'package:hotpot/generated/json/base/json_convert_content.dart';
import 'package:hotpot/models/table_order.dart';

TableOrder $TableOrderFromJson(Map<String, dynamic> json) {
	final TableOrder tableOrder = TableOrder();
	final int? id = jsonConvert.convert<int>(json['id']);
	if (id != null) {
		tableOrder.id = id;
	}
	final String? name = jsonConvert.convert<String>(json['name']);
	if (name != null) {
		tableOrder.name = name;
	}
	final String? dateOrder = jsonConvert.convert<String>(json['date_order']);
	if (dateOrder != null) {
		tableOrder.dateOrder = dateOrder;
	}
	final List<TableOrderLines>? lines = jsonConvert.convertListNotNull<TableOrderLines>(json['lines']);
	if (lines != null) {
		tableOrder.lines = lines;
	}
	final int? tableId = jsonConvert.convert<int>(json['table_id']);
	if (tableId != null) {
		tableOrder.tableId = tableId;
	}
	final String? trackingNumber = jsonConvert.convert<String>(json['tracking_number']);
	if (trackingNumber != null) {
		tableOrder.trackingNumber = trackingNumber;
	}
	return tableOrder;
}

Map<String, dynamic> $TableOrderToJson(TableOrder entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['date_order'] = entity.dateOrder;
	data['lines'] =  entity.lines?.map((v) => v.toJson()).toList();
	data['table_id'] = entity.tableId;
	data['tracking_number'] = entity.trackingNumber;
	return data;
}

TableOrderLines $TableOrderLinesFromJson(Map<String, dynamic> json) {
	final TableOrderLines tableOrderLines = TableOrderLines();
	final int? id = jsonConvert.convert<int>(json['id']);
	if (id != null) {
		tableOrderLines.id = id;
	}
	final int? qty = jsonConvert.convert<int>(json['qty']);
	if (qty != null) {
		tableOrderLines.qty = qty;
	}
	final List<int>? attributeValueIds = jsonConvert.convertListNotNull<int>(json['attribute_value_ids']);
	if (attributeValueIds != null) {
		tableOrderLines.attributeValueIds = attributeValueIds;
	}
	final double? priceUnit = jsonConvert.convert<double>(json['price_unit']);
	if (priceUnit != null) {
		tableOrderLines.priceUnit = priceUnit;
	}
	final String? uuid = jsonConvert.convert<String>(json['uuid']);
	if (uuid != null) {
		tableOrderLines.uuid = uuid;
	}
	final double? priceSubtotal = jsonConvert.convert<double>(json['price_subtotal']);
	if (priceSubtotal != null) {
		tableOrderLines.priceSubtotal = priceSubtotal;
	}
	final double? priceSubtotalIncl = jsonConvert.convert<double>(json['price_subtotal_incl']);
	if (priceSubtotalIncl != null) {
		tableOrderLines.priceSubtotalIncl = priceSubtotalIncl;
	}
	final int? productId = jsonConvert.convert<int>(json['product_id']);
	if (productId != null) {
		tableOrderLines.productId = productId;
	}
	final int? refundedQty = jsonConvert.convert<int>(json['refunded_qty']);
	if (refundedQty != null) {
		tableOrderLines.refundedQty = refundedQty;
	}
	final int? priceExtra = jsonConvert.convert<int>(json['price_extra']);
	if (priceExtra != null) {
		tableOrderLines.priceExtra = priceExtra;
	}
	final String? fullProductName = jsonConvert.convert<String>(json['full_product_name']);
	if (fullProductName != null) {
		tableOrderLines.fullProductName = fullProductName;
	}
	final String? note = jsonConvert.convert<String>(json['note']);
	if (note != null) {
		tableOrderLines.note = note;
	}
	final Map<String, int>? attributeMultiValue = jsonConvert.convert<Map<String, int>>(json['attribute_multi_value']);
	if (attributeMultiValue != null) {
		tableOrderLines.attributeMultiValue = attributeMultiValue;
	}
	final String? vegetableSequenceId = jsonConvert.convert<String>(json['vegetable_sequence_id']);
	if (vegetableSequenceId != null) {
		tableOrderLines.vegetableSequenceId = vegetableSequenceId;
	}
	final int? hasSend = jsonConvert.convert<int>(json['hasSend']);
	if (hasSend != null) {
		tableOrderLines.hasSend = hasSend;
	}
	final List<String>? comboLineIds = jsonConvert.convertListNotNull<String>(json['combo_line_ids']);
	if (comboLineIds != null) {
		tableOrderLines.comboLineIds = comboLineIds;
	}
	final String? comboParentId = jsonConvert.convert<String>(json['combo_parent_id']);
	if (comboParentId != null) {
		tableOrderLines.comboParentId = comboParentId;
	}
	return tableOrderLines;
}

Map<String, dynamic> $TableOrderLinesToJson(TableOrderLines entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['qty'] = entity.qty;
	data['attribute_value_ids'] =  entity.attributeValueIds;
	data['price_unit'] = entity.priceUnit;
	data['uuid'] = entity.uuid;
	data['price_subtotal'] = entity.priceSubtotal;
	data['price_subtotal_incl'] = entity.priceSubtotalIncl;
	data['product_id'] = entity.productId;
	data['refunded_qty'] = entity.refundedQty;
	data['price_extra'] = entity.priceExtra;
	data['full_product_name'] = entity.fullProductName;
	data['note'] = entity.note;
	data['attribute_multi_value'] = entity.attributeMultiValue;
	data['vegetable_sequence_id'] = entity.vegetableSequenceId;
	data['hasSend'] = entity.hasSend;
	data['combo_line_ids'] =  entity.comboLineIds;
	data['combo_parent_id'] = entity.comboParentId;
	return data;
}

TableOrderLinesAttributeMultiValue $TableOrderLinesAttributeMultiValueFromJson(Map<String, dynamic> json) {
	final TableOrderLinesAttributeMultiValue tableOrderLinesAttributeMultiValue = TableOrderLinesAttributeMultiValue();
	return tableOrderLinesAttributeMultiValue;
}

Map<String, dynamic> $TableOrderLinesAttributeMultiValueToJson(TableOrderLinesAttributeMultiValue entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	return data;
}